//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
import CampsiteLeaseBox from '../../views/mall/CampsiteLeaseBox.vue'
let extension = {
    components: {//动态扩充组件或组件路径
        //表单header、content、footer对应位置扩充的组件
        gridHeader: '',//{ template: "<div>扩展组xx件</div>" },
        gridBody: CampsiteLeaseBox,
        gridFooter: '',
        //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
        modelHeader: '',
        modelBody: '',
        modelFooter: ''
    },
    buttons: {
        view: [
        ], box: [], detail: []
    },//扩展的按钮
    methods: {//事件扩展
        rowClick ({ row, column, event }) {
            this.$refs.table.$refs.table.toggleRowSelection(row);
            return true;
        },
        onInit () {
            this.$store.getters.data().viewPageTest = this;
            this.columns.push({
                title: '操作',
                fixed: 'right',
                width: 150,
                render: (h, { row, column, index }) => {
                    return [
                        h(
                            "el-button", {
                            props: {
                                type: 'text', size: 'mini',
                                disabled: row.status != 2 ? true : false
                            },
                            style: {
                                "margin-left": "10px"
                            },
                            on: {
                                click: (e) => {
                                    this.$refs.gridBody.openRZ(row)
                                }
                            }
                        },
                            '入账'
                        ),
                        h(
                            "el-button", {
                            props: {
                                type: 'text', size: 'mini',
                                disabled: row.status != 2 ? true : false
                            },
                            style: {
                                "margin-left": "10px"
                            },
                            on: {
                                click: (e) => {
                                    this.$refs.gridBody.openBG(row)
                                }
                            }
                        },
                            '变更'
                        ),
                        h(
                            "el-button", {
                            props: {
                                type: 'text', size: 'mini',
                                disabled: row.status != 2 ? true : false
                            },
                            style: {
                                "margin-left": "10px"
                            },
                            on: {
                                click: (e) => {
                                    this.$refs.gridBody.openJZ(row)
                                }
                            }
                        },
                            '结账'
                        ),
                    ]
                }
            })
        },
        searchBefore (param) {
            let wheres = [{
              'name': 'status',
              'value': '2',
              'displayType': 'text'
            }]
            param.wheres.push(...wheres);
            return true;
          },
    }
};
export default extension;